import book.BookList;
import sun.rmi.runtime.Log;
import user.Administartor;
import user.OrdinaryUser;
import user.User;

import java.util.Scanner;

public class Main {
    private static String name;
    private static int identity;
    public static User Login(){
        Scanner s = new Scanner(System.in);
        System.out.println("请输入您的姓名：");
        name = s.nextLine();
        System.out.println("请输入您的身份：（0. 管理员  1. 普通用户）");
        identity = s.nextInt();
        if(identity == 0){
            return new Administartor(name);
        }else{
            return new OrdinaryUser(name);
        }
    }
    public static void main(String[] args) {
        //定义书架
        BookList bookshelf = new BookList();
        User user = Login();
        while(true){
            int choice = user.menu();
            user.doOperation(choice, bookshelf);
        }
    }
}